Carbon


GetString

Header: TextUtils.h Carbon status: Supported

Loads a string from a string ('STR ') resource into memory.

StringHandle GetString (
    SInt16 stringID
);
Parameter descriptions
stringID

The resource ID of the string ('STR ') resource containing the string.

function result

A handle to a string with the specified resource ID. If necessary, GetString reads the handle form the resource file. If GetString cannot read the resource, it returns NULL.

DISCUSSION

GetString calls the GetResource function of the Resource Manager to access the string. This means that if the specified resource is already in memory, GetString simply returns its handle.

Like the NewString function, GetString returns a handle whose size is based upon the actual length of the string.

If your application uses a large number of strings, it is more efficient to store them in a string list ('STR#') resource than as individual resources in the resource file. You then use the GetIndString function to access each string in the list.

SPECIAL CONSIDERATIONS

GetString does not create a copy of the string.

GetString may move memory; your application should not call this function at interrupt time.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)